package com.fs.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.pojo.House;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author yyds
 * @fileName Houses
 * @date 2024/9/10 15:35
 * @description
 **/
@Repository
public interface HouseMapper extends BaseMapper<House> {
    @Select("select * from  houses where hid=#{id}")
    @Results(value = {
            @Result(column = "pid",property = "user",
                    one =@One(select = "com.fs.mapper.UserMapper.selectById")),
            @Result(column = "sid",property = "streets",
                    one =@One(select = "com.fs.mapper.StreetsMapper.selectById")),
            @Result(column = "tid",property = "htypes",
                    one =@One(select = "com.fs.mapper.HtypesMapper.selectById")),
            @Result(column = "did",property = "districts",
                    one =@One(select = "com.fs.mapper.DistrictsMapper.selectById"))
    })
    House findById(Integer id);
}
